package com.liao.starapp.star;

import android.graphics.Bitmap;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import androidx.appcompat.app.ActionBar;
import androidx.appcompat.app.AppCompatActivity;

import com.liao.starapp.R;
import com.liao.starapp.utils.GetAssetsData;

public class StarDetailActivity extends AppCompatActivity implements View.OnClickListener {
    private Star.StarinfoBean star;
    private ImageView img_back;
    private ImageView head_img;
    private TextView tv_name;
    private TextView tv_date;
    private TextView tv_td;
    private TextView tv_gw;
    private TextView tv_yy;
    private TextView tv_tz;
    private TextView tv_zg;
    private TextView tv_ys;
    private TextView tv_zb;
    private TextView tv_hm;
    private TextView tv_js;
    private TextView tv_info;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_star_detail);
        ActionBar actionBar = getSupportActionBar();
        if (actionBar != null) {
            actionBar.hide();
        }
        star = (Star.StarinfoBean) getIntent().getSerializableExtra("star");
        getWindow().setStatusBarColor(getColor(R.color.actionBarColor));
        initView();
        initData();
    }

    private void initView() {
        img_back = (ImageView) findViewById(R.id.img_back);
        head_img = (ImageView) findViewById(R.id.head_img);
        tv_name = (TextView) findViewById(R.id.tv_name);
        tv_date = (TextView) findViewById(R.id.tv_date);
        tv_td = (TextView) findViewById(R.id.tv_td);
        tv_gw = (TextView) findViewById(R.id.tv_gw);
        tv_yy = (TextView) findViewById(R.id.tv_yy);
        tv_tz = (TextView) findViewById(R.id.tv_tz);
        tv_zg = (TextView) findViewById(R.id.tv_zg);
        tv_ys = (TextView) findViewById(R.id.tv_ys);
        tv_zb = (TextView) findViewById(R.id.tv_zb);
        tv_hm = (TextView) findViewById(R.id.tv_hm);
        tv_js = (TextView) findViewById(R.id.tv_js);
        tv_info = (TextView) findViewById(R.id.tv_info);

        img_back.setOnClickListener(this);
    }

    private void initData() {
        Bitmap bitmap = GetAssetsData.getGridViewImg(this, "xzcontentlogo/" + star.getLogoname() + ".png");
        head_img.setImageBitmap(bitmap);

        tv_name.setText(star.getName());
        tv_date.setText(star.getDate());
        tv_td.setText(star.getTd());
        tv_gw.setText(star.getGw());
        tv_yy.setText(star.getYy());
        tv_tz.setText(star.getTz());
        tv_zg.setText(star.getZg());
        tv_ys.setText(star.getYs());
        tv_zb.setText(star.getZb());
        tv_hm.setText(star.getHm());
        tv_js.setText(star.getJs());
        tv_info.setText(star.getInfo());
    }

    @Override
    public void onClick(View v) {
        onBackPressed();
        finish();
    }
}
